<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ page import="com.mysql.jdbc.Driver" %> 
<%@ page import="java.sql.*" %> 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'bunnka4.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<style type="text/css">
body {background-image:url("bunnka.jpg");
background-repeat:no-repeat;
background-attachment:fixed
}
</style>
  </head>
  
  <body>
 <% 
String driverName="com.mysql.jdbc.Driver"; 
String userName="root"; 
String userPasswd="x5"; 
String dbName="tosyokannri"; 
String tableName="bunnka"; 
String url="jdbc:mysql://127.0.0.1:3306/tosyokannri?"+"useUnicode=true&amp;characterEncoding=UTF-8";
Class.forName("com.mysql.jdbc.Driver").newInstance(); 
Connection connection=DriverManager.getConnection(url, userName, userPasswd); 
Statement statement = connection.createStatement(); 
String sql="SELECT * FROM bunnka LIMIT 150,50;";
ResultSet rs = statement.executeQuery(sql); 
out.println("序号"+"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+"书名"+"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+"作者"+"&nbsp;&nbsp;&nbsp;&nbsp;"+"书价"+"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+"出版日期");
%><br><%
while(rs.next()) { 
	out.print(rs.getInt(1)+"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
			+rs.getString(2)+"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
			+rs.getString(3)+"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
			+rs.getFloat(4)+"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
			+rs.getString(5));%><br><%
}
rs.close(); 
statement.close(); 
connection.close(); 
%> 
<br>
<a href="bunnka1.jsp">首页</a>
<a href="bunnka3.jsp">上一页</a>
<a href="bunnka1.jsp">1</a>
<a href="bunnka2.jsp">2</a>
<a href="bunnka3.jsp">3</a>
<a href="bunnka4.jsp">4</a>
<a href="bunnka5.jsp">5</a>
<a href="bunnka6.jsp">6</a>
<a href="bunnka5.jsp">下一页</a>
<a href="bunnka6.jsp">末页</a>
<a href="jiansuo.jsp">返回</a>
  </body>
</html>
